
# ifndef __DFX_RAY_H__
# define __DFX_RAY_H__

# include "dfxVector3.h"
# include "dfxMatrix4.h"
# include "dfxAabb.h"

namespace DFX
{
    class DFX_EXPORT Ray
    {
    public:

        Vector3 Origin;
        Vector3 Dir;

    public:

        Ray()
        {
        }

        Ray(const Vector3 &origin, const Vector3 &dir)
            : Origin(origin), Dir(dir)
        {
        }

        inline void Set(const Vector3 &origin, const Vector3 &dir)
        {
            Origin = origin;
            Dir = dir;
        }

        inline void DeTransform(const Matrix4 &m);

        inline bool Intersects(const Vector3 &v0, const Vector3 &v1, const Vector3 &v2,
            bool cull, Float32 *t);

        inline bool Intersects(const Vector3 &v0, const Vector3 &v1, const Vector3 &v2, bool cull,
            Float32 len, Float32 *t);

        inline bool Intersects(const Aabb &aabb, Float32 *t);
        inline bool Intersects(const Aabb &aabb, Float32 len, Float32 *t);
    };
}

# endif